/**
 * gis api
 * @author
 */

import axios from '@/api/http'

// 查询所有 tab
export const queryTabsByProjectIdApi = (options?: any) =>
  axios.request({
    ...options,
    url: '/gis/queryTabsByProjectId',
  })

// 新建 tab
export const addTabByProjectIdApi = (options?: any) =>
  axios.request({
    ...options,
    url: '/gis/addTabByProjectId',
  })

// 删除 tab
export const deleteTabByIdApi = (options?: any) =>
  axios.request({
    ...options,
    url: '/gis/deleteTabById',
  })

// 修改 tab
export const modifyTabApi = (options?: any) =>
  axios.request({
    ...options,
    url: '/gis/modifyTab',
  })

// 复制 tab
export const copyTabApi = (options?: any) =>
  axios.request({
    ...options,
    url: '/gis/copyTab',
  })

// 用户所有 gis 数据
export const getAllGisDataApi = (options?: any) =>
  axios.request({
    ...options,
    url: '/gis/queryGisFiles',
  })

// load 数据到图层管理
export const addLayerApi = (options?: any) =>
  axios.request({
    ...options,
    url: '/gis/addLayer',
  })

// 获取图层 layers
export const queryLayersByTabIdApi = (options?: any) =>
  axios.request({
    ...options,
    url: '/gis/queryLayersByTabId',
  })

// 删除图层 layer
export const deleteLayerByIdApi = (options?: any) =>
  axios.request({
    ...options,
    url: '/gis/deleteLayerById',
  })

// 修改图层名字 layer name
export const renameLayerApi = (options?: any) =>
  axios.request({
    ...options,
    url: '/gis/renameLayer',
  })

// 修改图层可见状态 layer
export const resetSeenApi = (options?: any) =>
  axios.request({
    ...options,
    url: '/gis/resetSeen',
  })

// 修改图层顺序 layer
export const resetOrderApi = (options?: any) =>
  axios.request({
    ...options,
    url: '/gis/resetOrder',
  })

// 获取图层数据 geojson
export const plotLayerByGeoJsonApi = (options?: any) =>
  axios.request({
    ...options,
    url: '/gis/plotLayerByGeoJson',
  })

// 计算全局周长/面积/长度
export const calculateAll = (options?: any) =>
  axios.request({
    ...options,
    url: '/gis/calculateAll',
  })
// 预览 几何中心图层
export const previewCentroidApi = (options?: any) =>
  axios.request({
    ...options,
    url: '：/gis/previewCentroid',
  })

// 确定 生成几何中心图层
export const saveCentroidLayerApi = (options?: any) =>
  axios.request({
    ...options,
    url: '/gis/saveCentroidLayer',
  })

// 预览 缓冲区图层
export const previewBufferApi = (options?: any) =>
  axios.request({
    ...options,
    url: '：/gis/previewBuffer',
  })

// 确定 生成缓冲区图层
export const saveBufferLayersApi = (options?: any) =>
  axios.request({
    ...options,
    url: '/gis/saveBufferLayers',
  })

// 近邻查询
export const nearSearchApi = (options?: any) =>
  axios.request({
    ...options,
    url: '/gis/nearSearch',
  })

// 天地图 行政区搜索服务
export const searchAdministrativeApi = (options?: any) =>
  axios.request({
    ...options,
    method: 'get',
    url: 'https://api.tianditu.gov.cn/administrative',
  })

// 获取图层数理分析可选属性
export const getNumericalColApi = (options?: any) =>
  axios.request({
    ...options,
    url: '/gis/getColTypes',
  })

// 数理分析 计算
export const getNumericalResponseApi = (options?: any) =>
  axios.request({
    ...options,
    url: '/gis/statistics',
  })

/**
 * 获取表格明细数据
 */
export const queryTableDetailApi = (options?: any) =>
  axios.request({
    ...options,
    url: '/tcolumn/queryDetail',
  })
/**
 * 获取每一列的数据
 */
export const queryQueryStatApi = (options?: any) =>
  axios.request({
    ...options,
    url: '/tcolumn/queryStat',
  })

/**
 * 数据转化 (点数据转化线数据)
 */
export const pointToLineApi = (options?: any) =>
  axios.request({
    ...options,
    url: '/gis/pointToLine',
  })

/**
 * 保存 tab 下的画布信息/图层信息
 */
export const saveInfoApi = (options?: any) =>
  axios.request({
    ...options,
    url: '/gis/saveInfo',
  })

/**
 * 同步至系统构建
 */
export const synchronousTabApi = (options?: any) =>
  axios.request({
    ...options,
    url: '/widget/save',
  })

/**
 * 查询当前画布是否同步至系统构建
 */
export const querySynchronousStatus = (options?: any) =>
  axios.request({
    ...options,
    url: '/widget/queryByTid',
  })

/**
 * 查询画布tab
 */
export const queryTabInfoByIdApi = (options?: any) =>
  axios.request({
    ...options,
    url: '/gis/queryTabInfoById',
  })

/**
 * 分片加载图层数据
 */
export const plotLayerBySliceGeoJsonApi = (options?: any) =>
  axios.request({
    ...options,
    url: '/gis/plotLayerBySliceGeoJson',
  })
